package com.baizw.cultivation.module.admin.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * 用户实体
 *
 * @author 剧终1204
 * @version V1.0
 * @date 2020年04月27日 14:21:18
 */
@Data
@ApiModel("用户实体")
@TableName("t_user")
@EqualsAndHashCode(callSuper = true)
public class UserEntity extends BaseEntity implements Serializable {

    @Size(max = 30, message = "用户昵称长度不能超过30个字符")
    @ApiModelProperty("用户昵称")
    private String name;

    @NotBlank(message = "用户账号不能为空")
    @Size(max = 30, message = "用户账号长度不能超过30个字符")
    @ApiModelProperty("登录名称")
    private String loginName;

    @ApiModelProperty(value = "密码", hidden = true)
    private String password;

    @JsonIgnore
    @ApiModelProperty(value = "加密盐值", hidden = true)
    private String salt;

    @ApiModelProperty("头像")
    private byte[] avatar;

    @Size(max = 11, message = "手机号码长度不能超过11个字符")
    @ApiModelProperty("联系电话")
    private String telephone;

    @ApiModelProperty("最后登录IP")
    private String lastLoginIp;

    @ApiModelProperty("最后登录时间")
    private String lastLoginTime;

    @NotNull(message = "请选择用户角色")
    @ApiModelProperty("角色ID")
    private Long roleId;

}
